<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Power Profiling Application</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51822 BLE SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('group__ble__sdk__app__pwr__mgmt.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#groups">Modules</a>  </div>
  <div class="headertitle">
<div class="title">Power Profiling Application</div>  </div>
<div class="ingroups"><a class="el" href="group__ble__sdk__apps.html">Example Applications</a></div></div>
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="groups"></a>
Modules</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html">main.c</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><p>Power profiling sample application main file. </p>
<br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>This application is designed to be used to measure the current consumption of the nRF51822, loaded with S110 SoftDevice, during advertisement and data transmission. The user can change some of the parameters (listed below) of this application, and measure current consumption.</p>
<p>This application also demonstrates the use of Vendor Specific (128 bit) UUIDs.</p>
<p>The source code and project file can be found in the <code>&lt;InstallFolder&gt;\Nordic\nrf51822\Board\nrf6310\ble\ble_app_pwr_profiling</code> folder.</p>
<p>This application has two modes of working.</p>
<p><b>1. Connectable mode:</b></p>
<p>In this mode, the application advertises in connectable mode. It sets itself up with a service and a characteristic with 'Notify' property. This characteristic has a CCCD associated with it.</p>
<p>Once the master enables notification of this characteristic (writes 0x0001 to this CCCD), the application starts sending notifications of this characteristic for a time interval equal to the value of <a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#ga21391c876b70819800ee07cabb337448">APP_CFG_CHAR_NOTIF_TIMEOUT</a>. The application will attempt to send one notification per connection interval, but this is not guaranteed. There is a possibility that in one connection interval there are no notifications but in the next one there are two notifications. This depends on when exactly the repeating application timer expires. But the total number of notifications sent by the application will be close to (<a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#ga21391c876b70819800ee07cabb337448">APP_CFG_CHAR_NOTIF_TIMEOUT</a> / (<a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#ga010a0abfa2f84b5290d55c0a3f3757f0">APP_CFG_CONNECTION_INTERVAL</a> * 1000)). After sending these notifications, the application puts the chip in 'System Off' mode.</p>
<p><b>2. Non-connectable mode:</b></p>
<p>In this mode, the application advertises the given length of data (<a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#gadc3efc37d835db80f2359a6d24edb5d1">APP_CFG_ADV_DATA_LEN</a>) for a given duration of time (<a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#ga560763b9fb39a5ff10a86255b583acc0">APP_CFG_NON_CONN_ADV_TIMEOUT</a>) in non-connectable mode, and then puts the chip in System Off mode.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>In both the above modes, the device name does not show up in the advertisement packet as per design. The advertisement packet only has 'Flags' and 'Manufacturer specific data' fields. This is done to make the least possible size of an advertisement packet as 8 bytes.</dd></dl>
<h2><a class="anchor" id="power_mgmt"></a>
Power Management</h2>
<p>The application demonstrates the use of two different power saving modes, namely CPU Sleep and System-Off mode. All sample applications delivered with the SDK use these two modes.</p>
<p><b>Low Power Mode:</b></p>
<p>The application uses the <a class="el" href="group__nrf__soc__api.html#ga2aae5f388f1b6179058c62e2fb05a547" title="Waits for an application event.">nrf_wait_for_app_event()</a> function to enter CPU sleep mode. This will place the chip in 'Low Power' mode. The chip will wake up from this mode on application interrupts. Typically any application should call <a class="el" href="group__nrf__soc__api.html#ga2aae5f388f1b6179058c62e2fb05a547" title="Waits for an application event.">nrf_wait_for_app_event()</a> in an infinite loop in main. It will return when an application interrupt has occurred, thereby allowing the main thread to process it if needed.</p>
<p><b>System OFF Mode:</b></p>
<p>This is the deepest power saving mode the system can enter. In this mode all core functionality is powered down, and most peripherals are therefore non-functional or non-responsive. The only mechanisms that are functional and responsive in this mode are the reset mechanism and the wake-up mechanism. This sample application starts up, configures wakeup buttons and enters this mode. On button presses, the application wakes up and goes into either 'Connectable mode' or 'Non-connectable mode' based on which button is pressed.</p>
<p>For more information on both of the above modes, see <a class="el" href="group__nrf__soc__api.html#ga2aae5f388f1b6179058c62e2fb05a547" title="Waits for an application event.">nrf_wait_for_app_event()</a> and the nRF51 Series User Specification (Section: POWER - Power control).</p>
<h2><a class="anchor" id="project_app_pwr_mgmt_setup"></a>
Setup</h2>
<p>Instruction on how to set up the nRF51822 Development Kit hardware: <a class="el" href="group__ble__sdk__apps__setup.html">'Setup'</a>.</p>
<p>LED assignments:</p>
<ul>
<li>No LEDs used by this application.</li>
</ul>
<p>Buttons assignments:</p>
<ul>
<li>Button 0: Place the application in connectable mode.</li>
<li>Button 1: Place the application in non-connectable mode.</li>
</ul>
<h2><a class="anchor" id="project_app_pwr_mgmt_test"></a>
Testing</h2>
<ol type="1">
<li>Compile and program the application.</li>
<li>Start Master Control Panel on the PC.</li>
<li>Click 'File-&gt;Options'. Verify that the connection interval value displayed in the 'Options' window is the same as <a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#ga010a0abfa2f84b5290d55c0a3f3757f0">APP_CFG_CONNECTION_INTERVAL</a>.</li>
<li>Close the Options window and click 'Start discovery' Master Control Panel main window.</li>
<li>Push Button 0 on the nRFgo board. Observe the application is advertising in connectable mode.</li>
<li>Connect to the device from Master Control Panel, click 'Service discovery' and then click 'Enable Services'.</li>
<li>Observe notifications of the characteristic being received by the master.</li>
<li>After <a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#ga21391c876b70819800ee07cabb337448">APP_CFG_CHAR_NOTIF_TIMEOUT</a> the Master control panel will lose connection with the chip because it would have entered System Off mode.</li>
<li>Verify the size of the characteristic value received in all the notifications was equal to <a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#ga25c08352c9bdbc5c273f2260753306ce">APP_CFG_CHAR_LEN</a>.</li>
<li>Click 'Back' button in the Master control panel, right click in the 'Discovered Devices' section in Master Control Panel and click 'Clear list' to clear the list of devices.</li>
<li>Verify that the device is not advertising.</li>
<li>Push Button 1 on the nRFgo board. Observe the application is advertising in non-connectable mode (the Adv. type field should be Non-Connectable)</li>
<li>Verify that the number of bytes in the Manufacturer Specific Data in Adv. data is <a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#gadc3efc37d835db80f2359a6d24edb5d1">APP_CFG_ADV_DATA_LEN</a> - 7</li>
<li>After <a class="el" href="group__ble__sdk__app__pwr__mgmt__main.html#ga560763b9fb39a5ff10a86255b583acc0">APP_CFG_NON_CONN_ADV_TIMEOUT</a>, clear the list of 'Discovered Devices'. Verify that the device is not advertising. </li>
</ol>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
